//
//  RootViewController.m
//  UI_08_senderData ___delegate
//
//  Created by dllo on 16/3/19.
//  Copyright © 2016年 XWH. All rights reserved.
//

#import "RootViewController.h"

@interface RootViewController ()
@property (nonatomic, retain) UITextField *textField;
@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 200, 60)];
    self.textField.placeholder = @"请输入文字";
    self.textField.backgroundColor = [UIColor cyanColor];
    
    self.textField.keyboardType = UIKeyboardTypeNamePhonePad;
    
    UIButton *buttOfBack = [UIButton buttonWithType:UIButtonTypeSystem];
    buttOfBack.frame = CGRectMake(100, 200, 150, 60);
    [buttOfBack setTitle:@"BACK" forState:UIControlStateNormal];
    buttOfBack.backgroundColor = [UIColor yellowColor];
    [buttOfBack addTarget:self action:@selector(buttonOfBack:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:self.textField];
    [self.view addSubview:buttOfBack];
    
    [self.textField release];
    
    
    // Do any additional setup after loading the view.
}


- (void)buttonOfBack:(UIButton *)sender{
 
    [self.rootDelegate changeValue:self.textField.text];
    
    [self.navigationController popToRootViewControllerAnimated:YES];
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
